﻿<Page
    x:Class="FLAC_WinRT.Example.App.MainPage"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:i="using:Microsoft.Xaml.Interactivity"
    xmlns:ic="using:Microsoft.Xaml.Interactions.Core"
    mc:Ignorable="d"
    Background="{ThemeResource ApplicationPageBackgroundThemeBrush}"
    DataContext="{Binding ViewModel, RelativeSource={RelativeSource Self}}">

    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>

        <StackPanel Grid.Row="0" Margin="24,17,0,28">
            <TextBlock Text="FLAC for Windows Runtime" Style="{StaticResource TitleTextBlockStyle}" />
            <TextBlock Text="example" Style="{StaticResource HeaderTextBlockStyle}" Margin="0,-7,0,0" />
        </StackPanel>
        
        <Grid Grid.Row="1" Margin="24,0">
            <ListBox ItemsSource="{Binding SongsCollection}" Background="Transparent" SelectedItem="{Binding SelectedSong, Mode=TwoWay}">
                <ListBox.ItemTemplate>
                    <DataTemplate>
                        <TextBlock Text="{Binding DisplayName}" Padding="0,6" Style="{StaticResource ListViewItemTextBlockStyle}" />
                    </DataTemplate>
                </ListBox.ItemTemplate>
            </ListBox>
        </Grid>
    </Grid>

    <i:Interaction.Behaviors>
        <ic:EventTriggerBehavior EventName="Loaded">
            <ic:InvokeCommandAction Command="{Binding UpdateSongsListCommand}" />
        </ic:EventTriggerBehavior>
    </i:Interaction.Behaviors>
    
    <Page.BottomAppBar>
        <CommandBar>
            <AppBarButton Icon="Play" Label="play selected" Command="{Binding PlaySelectedSongCommand}" />
        </CommandBar>
    </Page.BottomAppBar>
</Page>
